Code Review Bench PR #14133 - feat(core): back button event on Android, closes #8142#6
Conversation
| let handle = _api.register_android_plugin("app.tauri", "AppPlugin")?; | ||
| let handle_ref = &handle; | ||
| _app.manage(AppPlugin(*handle_ref)); |
There was a problem hiding this comment.
⚠️ Bug: Android plugin setup won't compile: move out of shared reference
The code at lines 139-140 creates a shared reference to handle then attempts to dereference it with *handle_ref:
let handle = _api.register_android_plugin("app.tauri", "AppPlugin")?;
let handle_ref = &handle;
_app.manage(AppPlugin(*handle_ref));PluginHandle<R> implements Clone but not Copy (confirmed in plugin.rs), so *handle_ref attempts to move out of a shared reference, which is a compile error: "cannot move out of *handle_ref which is behind a shared reference".
This code is behind #[cfg(target_os = "android")] so it only fails when compiling for Android targets, which may explain why it passed CI on other platforms.
The fix is to simply move handle directly, matching the existing pattern used in path/plugin.rs:
let handle = _api.register_android_plugin("app.tauri", "AppPlugin")?;
_app.manage(AppPlugin(handle));Was this helpful? React with 👍 / 👎
| let handle = _api.register_android_plugin("app.tauri", "AppPlugin")?; | |
| let handle_ref = &handle; | |
| _app.manage(AppPlugin(*handle_ref)); | |
| let handle = _api.register_android_plugin("app.tauri", "AppPlugin")?; | |
| _app.manage(AppPlugin(handle)); |
- Apply suggested fix
|
Note Gitar has paused automatic reviews. Comment "Gitar review" to trigger a review manually. Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
There was a problem hiding this comment.
Configure merge blocking · Maintainers can dismiss this review. Gitar never approves changes.
Benchmark PR for Gitar evaluation
Original PR: agentic-review-benchmarks#6
feat(core): back button event on Android, closes tauri-apps#8142
Summary by Gitar
onBackButtonPress()API in TypeScript/JavaScript to listen for Android back button presses withcanGoBackpayloadAppPlugin.ktwith default navigation fallback (webview goBack or activity finish when webview can't navigate back)hasListener()helper method toPlugin.ktfor checking registered event listenersallow-register-listenerandallow-remove-listenerfor app pluginThis will update automatically on new commits.